﻿using Abp.BackgroundJobs;
using Abp.Dependency;
using Abp.Threading.BackgroundWorkers;
using Abp.Threading.Timers;
using Hangfire;
using KelonProud.BackgroundJobs.Jobs;

namespace KelonProud.BackgroundJobs.Workers
{
    public class TestJobWorker : PeriodicBackgroundWorkerBase, ISingletonDependency
    {
        private readonly IBackgroundJobManager _backgroundJobManager;
        private readonly IRecurringJobManager _recurringJobManager;

        public TestJobWorker(AbpTimer timer, IBackgroundJobManager backgroundJobManager, IRecurringJobManager recurringJobManager) : base(timer)
        {
            _backgroundJobManager = backgroundJobManager;
            _recurringJobManager = recurringJobManager;
            timer.Period = 10000;
        }

        protected override void DoWork()
        {
            _backgroundJobManager.EnqueueAsync<TestBackgroudJob, int>(10);
        }
    }
}
